# -*- coding: utf-8 -*-
"""
Author:duan
Date: 2021/2/28 12:47
"""
from xmlrpc.server import SimpleXMLRPCServer
from socketserver import ThreadingMixIn


class ThreadXMLRPCServer(ThreadingMixIn, SimpleXMLRPCServer):
    pass


def sum(a, b):
    return a + b


def add(x, y):
    return x + y


if __name__ == '__main__':
    server = ThreadXMLRPCServer(('localhost', 8888))
    server.register_function(sum, "sum")  # 注册函数1
    server.register_function(add, 'add')  # 注册函数2
    print("Listening for Client")
    server.serve_forever()  # 保持等待调用状态
